using Churchtoolkit.DataAccess.Repositories;
using Churchtoolkit.Utils.MVP;
using Churchtoolkit.Web.Shell.Views;
using Churchtoolkit.DataAccess.Common;
using Churchtoolkit.DataAccess.Entities;
using Microsoft.Practices.ServiceLocation;
using Churchtoolkit.Utils.EmailProvider;


namespace Churchtoolkit.Web.Shell.Presenters
{
    public class DefaultViewPresenter : Presenter<IDefaultView>
    {
        NewsRepository _newsRepositroy;


        public DefaultViewPresenter(NewsRepository newsRepositroy)
        {
            _newsRepositroy = newsRepositroy;
        }

        public EntityResult<News> GetTopNews()
        {
            //ServiceLocator.Current.GetInstance<IEmailProvider>().SendMail("marina.opera@hotmail.com", "0001","Marina","marina","password","http://www.google.com");

            return _newsRepositroy.Find(null, NewsColumns.CreationDate, 0, 5);
        }
    }
}
